package schedule;

import com.zyx.edustatistics.service.StatisticsDailyService;
import com.zyx.edustatistics.utils.DateUtil;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author zyx
 * @version 1.0
 * @date 2022/1/11 011 13:24
 */

@Component
public class ScheduledTask {

    @Resource
    private StatisticsDailyService dailyService;

    @Scheduled(cron = "0 0 1 * * ? ")
    public void task() {
        dailyService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(), -1)));

    }
}
